#include "arch.h"
#include "config.h"
#include "time.h"
#include "serial.h"


void sti(void)
{
    asm volatile("stmfd sp!, {r0}");
    asm volatile("mrs r0, cpsr");
    asm volatile("bic r0, r0, #0x80");
    asm volatile("msr cpsr, r0");
    asm volatile("ldmfd sp!, {r0}");
}

void cli(void)
{
    asm volatile("stmfd sp!, {r0}");
    asm volatile("mrs r0, cpsr");
    asm volatile("orr r0, r0, #0x80");
    asm volatile("msr cpsr, r0");
    asm volatile("ldmfd sp!, {r0}");
}

void check_onkey();
void c_irq(void)
{

    int interrupt_status;
    cli();
    interrupt_status = 0;//ICIP & ICMR; /* check onlu un-masked interrupts */

    if((interrupt_status/* & IRQ_OST0*/)!=0){ /* timer interrupt */

        jiffies++;
        //check_onkey();
        //OSMR0 = OSCR + (3250000L)/TIMER_TICK_PER_SEC ; /* Trigger interrupts every 10 ms */
        //OSSR = OSSR_M0; /* clear the inerrupt */

    }

    sti();
}

